package cn.xhy.module.purchase.dal.mysql.materialdemand;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.xhy.module.purchase.dal.dataobject.materialdemand.MaterialDemandDO;
import org.apache.ibatis.annotations.Mapper;
import cn.xhy.module.purchase.controller.admin.materialdemand.vo.*;

/**
 * 单据 Mapper
 *
 * @author xhy
 */
@Mapper
public interface MaterialDemandMapper extends BaseMapperX<MaterialDemandDO> {

    default PageResult<MaterialDemandDO> selectPage(MaterialDemandPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDemandDO>()
                .eqIfPresent(MaterialDemandDO::getDocumentNumber, reqVO.getDocumentNumber())
                .betweenIfPresent(MaterialDemandDO::getDocumentDate, reqVO.getDocumentDate())
                .eqIfPresent(MaterialDemandDO::getType, reqVO.getType())
                .eqIfPresent(MaterialDemandDO::getBelongingProject, reqVO.getBelongingProject())
                .eqIfPresent(MaterialDemandDO::getAuditStatus, reqVO.getAuditStatus())
                .betweenIfPresent(MaterialDemandDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MaterialDemandDO::getId));
    }

}